<%--
  Created by IntelliJ IDEA.
  User: wangj
  Date: 2020/4/19
  Time: 19:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改</title>
</head>
<body>
    <div style="margin-left: 30%;margin-top: 5%">
    <form>
        <input type="hidden" id="resumeId" value="${resume.id}">
        <table>
            <tr>
                <td>姓名</td>
                <td>
                    <input type="text" id="name" name="name" value="${resume.name}"/>
                </td>
            </tr>
            <tr>
                <td>地址</td>
                <td>
                    <input type="text" id="address" name="address" value="${resume.address}"/>
                </td>
            </tr>
            <tr>
                <td>电话</td>
                <td>
                    <input type="text" id="phone" name="phone" value="${resume.phone}"/>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <input type="button" value="提交" id="updateResume">
                </td>
            </tr>

        </table>
    </form>
</div>
    <script src="/js/jquery-1.9.1.min.js" type="application/javascript"></script>
<script>
    $(function(){
        updateResume.init();
    });
    let updateResume = {
        init:function() {
            $('#updateResume').click(function() {
               $.ajax({
                 url:"/resume/update" ,
                 type:'post',
                 dataType:'json',
                 data:{'name':$('#name').val(),'address':$('#address').val(),'phone':$('#phone').val(),'id':$('#resumeId').val()},
                 success:function(data) {
                     if (data.errCode == 200) {
                         window.location = '/resume/'
                     } else {
                         alert('修改失败');
                     }
                 }
               });
            });
        },
    };
</script>
</body>
</html>
